#ifndef GATESERVER_PROTOCOL_H
#define GATESERVER_PROTOCOL_H

// following protocol is maily used in the commmunication between gate server
// and other server via pipe
enum
{
    GT_USER_TOKEN_NTF_ID = 1,
    GT_FORWARD_NTF_ID,
    GT_USER_VALIDATE_REQ_ID,
    GT_SET_DEST_SERVER_NTF_ID,
    GT_BACK2_DB_SERVER_NTF_ID,
    GT_NOTIFY_USER_ONLINE_NTF_ID,
    GT_NOTIFY_USER_OFFLINE_NTF_ID,
    GT_USER_COUNT_NTF_ID,
    GT_USER_VALIDATE_ACK_ID,
};

// Login server pushes the session token 
typedef struct {
    uint32 nUserID;
    uint32 nToken;
} GT_USER_TOKEN_NTF_PKG;

// transport the message forward to other server or backward
typedef struct {
    uint64 nProxyID;
    uint32 nSize;
} GT_FORWARD_NTF_PKG;

// client sends its first message to do the validation thing
typedef struct {
    uint32 nUserID;
    uint32 nToken;
} GT_USER_VALIDATE_REQ_PKG;

// game server tells the gate server that itself is the destination of 
// specified proxy
typedef struct {
    uint64 nProxyID;
    uint32 nServerIP;
} GT_SET_DEST_SERVER_NTF_PKG;

typedef struct
{
    uint64 nProxyID;
} GT_BACK2_DB_SERVER_NTF_PKG;

typedef struct
{
    uint64 nProxyID;
    uint32 nUserID;
    uint32 nToken;
} GT_NOTIFY_USER_ONLINE_NTF_PKG;

typedef struct
{
    uint64 nProxyID;
    uint32 nUserID;
} GT_NOTIFY_USER_OFFLINE_NTF_PKG;

typedef struct
{
    uint16 port;
    uint16 count;
} GT_USER_COUNT_NTF_PKG;

typedef struct
{
    uint8 error_code;
} GT_USER_VALIDATE_ACK_PKG;

#endif // endif of GATESERVER_PROTOCOL_H
